const Koa = require("koa");
const bodyParse = require("koa-bodyparser");

// 动态路由加载
const useRoutes = require("../router/index");

const errorHandler = require("./error-handle");
const app = new Koa();

app.useRoutes = useRoutes;
//进行json参数解析
app.use(bodyParse());
// 进行路由统一注册
app.useRoutes();
// 错误处理
app.on("error", errorHandler);
module.exports = app;
